﻿@using BrnMall.Manager.Domain.Distribution
@using BrnMall.Web.StoreAdmin.Models
@model BrnMall.Web.StoreAdmin.Models.AgentListModel

@section header{
    <title>代理商列表</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
}
@section body{
    <h1 class="rightH1 nav-fx">
        小程序分销 &gt; 代理管理 &gt; <span class="rightH1-cur">代理商列表</span> 
        <div class="right">
            
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    @using (Html.BeginForm("AgentList", "Distributor"))
    {
    
        <div class="dataListSearch">
            <table height="32">
                <tbody class="col4">
                <tr>
                    <td class="td1">代理商等级：@Html.DropDownListFor(x => x.GradeId, Model.DisGrades)</td>        
                    <td class="td2">代理商名称：@Html.TextBoxFor(x => x.DisStoreName, new { height = "18" })</td>   
                    <td class="td3">订单总额：@Html.TextBoxFor(x => x.OrdersTotalStart, new { height = "18" })-@Html.TextBoxFor(x=>x.OrdersTotalEnd,new {height="18"})</td>
                    <td><input id="SearchDistributor" name="SearchDistributor" type="image" class="searchBut submit" src="/admin_store/images/s.jpg" /></td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="dataList">
            <table width="100%">
                <thead>
                <tr>
                    <th width="10" align="center"><input type="checkbox" id="allSelect"/></th>
                    <th align="left">编号</th>
                    <th align="left">头像</th>
                    <th align="left"  width="120">用户昵称</th>
                    <th align="left"  width="120">代理商名称</th>
                    <th align="center">等级</th>
                    @*<th align="left"  width="120">联系人</th>*@
                    <th align="left">联系电话</th>
                    <th align="left">总销售额</th>
                    <th align="left">可提现</th>
                    <th align="left">已提现</th>
                    <th align="left">申请时间</th>
                    <th align="left">状态</th>
                    <th align="left" style="width:125px">管理操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach (AgentViewModel dis in Model.AgentList)
                {
                    <tr>
                        <td align="center"><input type="checkbox" value="@dis.Id" selectItem="true" name="newsIdList" /></td>
                        <td align="left">@dis.Id</td>
                        <td align="left"><img src="@dis.ShowLogo" style="border-radius: 25px;" width="50" height="50" alt="" /> </td>
                        <td align="left">@dis.LinkMan</td>
                        <td align="left">@dis.DisStoreName</td>
                        <td align="left">@dis.DisGrade.Name</td>
                        @*<td align="left">@dis.LinkMan</td>*@
                        <td align="left">@dis.PhoneNumber</td>
                        <td align="center">
                            @dis.OrdersTotal.ToString("0.00")
                        </td>
                        <td align="center">
                            @dis.AccountBalance.ToString("0.00")
                        </td>
                        <td align="center">
                            @dis.RequestBalance
                        </td>
                        <td align="left">@dis.CreateTime.ToString("yyyy-MM-dd")
                            
                        </td>
                        <td align="left">
                            @if (dis.Status == 0)
                            {
                                @:待审核
                            }else if (dis.Status == 1)
                            {
                                @:已审核
                            }else if (dis.Status == 2)
                            {
                                @:已关闭
                            }

                        </td>
                        <td align="left">
                            @Html.ActionLink("编辑", "EditAgent", new { id = @dis.Id }, new { @class = "editOperate" })
                            <span class="btn-line">|</span>
                            @if (dis.Status == 0)
                            {
                                @Html.ActionLink("审核", "SetAgentStatus", new { id = @dis.Id, status = 1 }, new { @class = "editOperate checkOperate" })
                                <span class="btn-line">|</span>
                            }
                            else if (dis.Status == 1)
                            {
                                @Html.ActionLink("关闭", "SetAgentStatus", new { id = @dis.Id, status = 2 }, new { @class = "editOperate closeOperate" })
                                <span class="btn-line">|</span>
                            }
                            else if (dis.Status == 2)
                            {
                                @Html.ActionLink("打开", "SetAgentStatus", new { id = @dis.Id, status = 1 }, new { @class = "editOperate openOperate" })
                                <span class="btn-line">|</span>
                            }
                            @Html.ActionLink("删除", "DeleteDistributor", new { id = @dis.Id }, new { @class = "editOperate deleteOperate" })
                            <br />
          
                            @Html.ActionLink("查看详情", "ViewAgent", new { id = @dis.Id }, new { @class = "editOperate" })
                        </td>
                    </tr>
                }
                </tbody>
            </table>
        </div>
        <div class="dataListEdit">
            <a href="#" delUrl="@Url.Action("delnews")" class="batch batchDel">批量删除</a>
            <div class="page">
                @Html.StoreAdminPager(Model.PageModel)
            </div>
        </div>
    }
}